package com.sky.service.impl;

import com.sky.entity.Setmeal;
import com.sky.mapper.WorkCenterMapper;
import com.sky.service.WorkCenterService;
import com.sky.vo.*;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class WoekCenterServiceImpl implements WorkCenterService {


    @Autowired
    private WorkCenterMapper workCenterMapper;

    @Override
    public SetmealOverViewVO selectOverviewSetmeals() {

        SetmealOverViewVO setmealOverViewVO=new SetmealOverViewVO();

//      //查询在售
        setmealOverViewVO.setSold(workCenterMapper.getSoldSetmeals());
        //查询停售
        setmealOverViewVO.setDiscontinued(workCenterMapper.getDiscontinuedSetmeals());

        return setmealOverViewVO;

    }

    @Override
    public DishOverViewVO selectOverviewDishes() {
        DishOverViewVO dishOverViewVO=new DishOverViewVO();

        //查询在售
        dishOverViewVO.setSold(workCenterMapper.getSoldDishes());
        //查询停售
        dishOverViewVO.setDiscontinued(workCenterMapper.getDiscontinuedDishes());
        return dishOverViewVO;
    }

    @Override
    public OrderOverViewVO selectOverviewOrders() {
        OrderOverViewVO orderOverViewVO=new OrderOverViewVO();

        //查询待派单
        orderOverViewVO.setWaitingOrders(workCenterMapper.getWaitingOrders());
        //查询派单中
        orderOverViewVO.setDeliveredOrders(workCenterMapper.getDeliveredOrders());
        //查询已完成
        orderOverViewVO.setCompletedOrders(workCenterMapper.getCompletedOrders());
        //查询已取消
        orderOverViewVO.setCancelledOrders(workCenterMapper.getCancelledOrders());
        //查询所有
        orderOverViewVO.setAllOrders(workCenterMapper.getAllOrders());
        return orderOverViewVO;
    }

    @Override
    public BusinessDataVO selectBusinessData() {
        BusinessDataVO businessDataVO = new BusinessDataVO();
        //查询总营业额
//        businessDataVO.setTurnover(workCenterMapper.allSetmeals().getTurnover());
//        //查询有效订单数
//        businessDataVO.setValidOrderCount(workCenterMapper.getValidOrders());
//        //查询订单完成率
//        businessDataVO.setOrderCompletionRate(workCenterMapper.getOrderCompletionRate());
//        //查询平均下单价
//        businessDataVO.setUnitPrice(workCenterMapper.getUnitPrice());
//        //查询新用户数
//        businessDataVO.setNewUsers(workCenterMapper.getNewUsers());
        return businessDataVO;


    }
}
